import request from '@/axios'
import { SysRoleAccountDetailVo, SysRoleAccountEditQo, SysRoleAccountListVo, SysRoleAccountSearchQo } from './types'
import { BaseDeleteQo } from '@/base/api/BaseQo'
import { KeyLabelValueVo } from '@/base/api/KeyLabelValueVo'

export const sysRoleAccountPageApi = (data: SysRoleAccountSearchQo): Promise<IResponse<Array<SysRoleAccountListVo>>> => {
  return request.post({ url: '/sysRoleAccount/page.adw', data })
}

export const sysRoleAccountDetailApi = (id: number): Promise<IResponse<SysRoleAccountDetailVo>> => {
  const data = { id }
  return request.post({
    url: '/sysRoleAccount/detail.adw',
    data
  })
}

export const sysRoleAccountAddApi = (data: SysRoleAccountEditQo): Promise<IResponse<number>> => {
  return request.post({ url: '/sysRoleAccount/add.adw', data })
}

export const sysRoleAccountUpdateApi = (data: SysRoleAccountEditQo): Promise<IResponse<void>> => {
  return request.post({ url: '/sysRoleAccount/update.adw', data })
}

export const sysRoleAccountDeleteApi = (data: BaseDeleteQo): Promise<IResponse<void>> => {
  return request.post({ url: '/sysRoleAccount/delete.adw', data })
}

// [[ OnflowGenerator Range (- selectFunctions -) Start ]]
export const selectSysRoleAccountRoleIdListApi = (
  data: SysRoleAccountSearchQo
): Promise<IResponse<Array<KeyLabelValueVo>>> => {
  return request.post({ url: '/sysRoleAccount/selectRoleIdList.adw', data })
}
export const selectSysRoleAccountAccountIdListApi = (
  data: SysRoleAccountSearchQo
): Promise<IResponse<Array<KeyLabelValueVo>>> => {
  return request.post({ url: '/sysRoleAccount/selectAccountIdList.adw', data })
}
// [[ OnflowGenerator Range (- selectFunctions -) End ]]
